<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<script type="text/javascript">
		var p = document.getElementById('m')

		var a = new Date()

		document.write(a.getTime())

		document.write('<br>')

		var b = new Date('2017-01-01,00:00:00')

		document.write(b.getTime())

		document.write('<br>')

		var c = (b-a)/1000

		function run (x) {
			x=c

			if(x<60){
				return x+'秒';
			}else if(x<3600){
				return parseInt(x/60)+"分"+x%60+"秒";
			}else if (x<86400){

				h =parseInt(x/3600);

				m =parseInt((x%3600)/60);

				s = (x%3600)%60;

				return h+"小时"+m+"分"+s+"秒";
			}else{

				d =parseInt(x/86400);

				h =parseInt((x%86400)/3600);

				m =parseInt(((x%86400)%3600)/60);

				s =parseInt((((x%86400)%3600)%60)%60);

				return d+"天"+h+"小时"+m+"分"+s+"秒";
			}
			
		}

		var y=run()
		
		document.write(y)
		setInterval(p.textContent=y, 1000)
		// var a = new Date()

		// document.write(a.getTime())

		// document.write('<br>')

		// var b = new Date('2017-01-01,00:00:00')

		// document.write(b.getTime())

		// document.write('<br>')

		// var c = (b-a)/1000





	</script>
</head>
<body>
	<p id="p">dadv</p>
</body>
</html>